/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package business;

import java.util.Date;

/**
 *
 * @author khanhanh
 */
public class LogicBusiness {

    public int dateDiff(Date fromDate, Date toDate) {
        long tempPickUp;
        long tempDropOff;
        tempPickUp = fromDate.getTime();
        tempDropOff = toDate.getTime();
        long tempDate = (tempDropOff - tempPickUp) / (1000 * 60 * 60 * 24);
        if (tempDate < 0) {
            tempDate = 0;
        }
        if (tempDate == 0) {
            tempDate = 1;
        }

        return (int) tempDate;
    }
}
